<?php 
require_once("connect_db.php");
$sqlTeacher="select * from teacher";
$queryTeacher=mysql_query($sqlTeacher);

$i=0;
while($row = mysql_fetch_array($queryTeacher))
{ 
$arr["text"]=$row["teach_name"]." ".$row["teach_lname"];
$arr["value"]=$row["teach_id"];
$arr["selected"]=false;
if($row["teach_sex"]=="1")
$arr["description"]="เพศ : ชาย";
else 
$arr["description"]="เพศ : หญิง";
$arr["imageSrc"]="../uploads/teacher/pics/".$row["teach_pic"];
$main_arr[] = $arr;
$i++;
}

$json = json_encode($main_arr);
echo $json;
?>